#pragma once
#include <stdio.h> 
#include <windows.h>
#include <assert.h>

#define SAFE_DEL_ARRAY(p)	{if(p) delete []p; p = 0;}
#define SAFE_DEL(p)			{if(p) delete p; p = 0;}
#define DEBUG_ASSERT(e) assert(e)
#ifdef _DEBUG
	#define DEBUG_TO_OUTPUT(FORMAT,...) \
		{\
			char s_debug[200]; \
			sprintf_s(s_debug, FORMAT, __VA_ARGS__); \
			OutputDebugStringA(s_debug) ;\
		}	
#else //#ifdef _DEBUG
	//#define DEBUG_TO_OUTPUT(FORMAT,...)
#endif //#ifdef _DEBUG

#ifdef _DEBUG
	#define _CRTDBG_MAP_ALLOC
	#include <crtdbg.h>
	#define DEBUG_DUMPLEAK() _CrtDumpMemoryLeaks()
	
	#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) 
	#define new DEBUG_NEW 
 
	#ifndef malloc 
		#define malloc( size ) _malloc_dbg( size, _NORMAL_BLOCK, __FILE__, __LINE__) 
	#endif 
#else //#ifdef _DEBUG
	#define DEBUG_DUMPLEAK()
#endif //#ifdef _DEBUG

